package ludo;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class StartLudo {

	public static void main(String[] args) throws Exception{

		int noPlayers = 4;
		if (args.length==1){
			noPlayers=Integer.parseInt(args[0]);
		}

		// code needed for keyboard input
		BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in));
		String temp;

		Engine g = new Engine(noPlayers);
		g.addView(new SimpleView(g));
		g.start();

		while(true){
			System.out.println("Enter square to move from, -1 to pass.");
			System.out.print("Player " + g.playerInTurn + ">");
			temp = br.readLine();
			int i = -2;
			try{
				i = Integer.parseInt(temp);
			} catch (Exception e){
			}
			if(!g.move(i)){
				System.out.println("Illegal move!");
			}
		}
	}

}


